package cn.ctodb.notebook.wxapp.service.dto;


import cn.ctodb.notebook.wxapp.domain.Pic;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;

/**
 * A DTO for the Message entity.
 */
public class MessageDTO implements Serializable {

    private Long id;

    @Size(max = 1000)
    private String content;

    private String address;

    private Boolean open;

    private Long userId;

    private Set<PicDTO> pics = new HashSet<>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Boolean isOpen() {
        return open;
    }

    public void setOpen(Boolean open) {
        this.open = open;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long wxUserId) {
        this.userId = wxUserId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        MessageDTO messageDTO = (MessageDTO) o;
        if(messageDTO.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), messageDTO.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "MessageDTO{" +
            "id=" + getId() +
            ", content='" + getContent() + "'" +
            ", address='" + getAddress() + "'" +
            ", open='" + isOpen() + "'" +
            "}";
    }

    public Set<PicDTO> getPics() {
        return pics;
    }

    public void setPics(Set<PicDTO> pics) {
        this.pics = pics;
    }
}
